<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="common.inc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>RONE-CRM   软件推动发展·客户决定未来</title>
<link href="./css/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" language="javascript">
<!--
	function checkForm(){
		var userCode = document.getElementById("userCode");
		var password = document.getElementById("password");
		
		var isUpdatePassword = document.getElementById('isUpdatePassword');
		var newPassword = document.getElementById("newPassword");
		var newPassword2 = document.getElementById("newPassword2");
		
		if(userCode.value == ""){
			alert("用户名称不能为空！");
			return false;
		}
		if(password.value == ""){
			alert("用户密码不能为空！");
			return false;
		}
		
		if(isUpdatePassword.checked){
			if(newPassword.value == ""){
				alert("新密码不能为空！");
				return false;
			}
			if(newPassword2.value == ""){
				alert("确认密码不能为空！");
				return false;
			}
			if(newPassword.value != newPassword2.value){
				alert("两次输入的密码不相同！");
				return false;
			}
		}
		return true;
	}

	function showHidden(id){
		var obj = document.getElementById(id);
		var objs = document.getElementById('isUpdatePassword');
		if(obj.style.display == "none" && objs.checked){
			document.getElementById(id).style.display = "block";
		}else if(!objs.checked){
			document.getElementById(id).style.display = "none";
		}
	}
	
	function login(){
		var obj = document.getElementById("language");
		var locale = "zh_CN";
		if(obj != null){
			locale = obj.value;
		}
		if(checkForm()){
			document.loginForm.action = "./login.do?action=submitLogin&locale="+locale;
			document.loginForm.submit();
		}
	}
	
	function keyDown(){
		if(event.keyCode == 13){
			login();
		}
	}
	
	function initPage(){
		if("<c:out value='${loginFail}'/>" == 1){
			alert("用户名称或密码有误！");
		}
		
		if("<c:out value='${loginFail}'/>" == 2){
			alert("超出可同时在线用户个数，如需增加请联系销售商购买！");
		}
		
		document.getElementById("userCode").focus();
	}
	
-->
</script>
</head>
<body onload="initPage()" style="background-color: #98B2B8;">
<form name="loginForm" action="" method="post">
	<table class="login_bg" align="center" style="margin-top: 180px;">
		<tr>
			<td colspan="4" height="260"></td>
		</tr>
		<tr valign="top" height="30">
			<td>
				&nbsp;&nbsp;用户名：
				<input id="userCode" name="userCode" class="input_login" type="text" value="101" onkeydown="keyDown()">
			</td>
			<td>
				密码：
				<input id="password" name="password" class="input_login" type="password" value="viper407919" onkeydown="keyDown()"/>
			</td>
			<td>
				<input id="isUpdatePassword" type="checkbox" onclick="showHidden('tCheckbox')" hidefocus="true" value="1"/>修改密码
			</td>
			<td>
				语言：
				<select id="language" name="language" style="width: 65px;border: solid 1px #000000;">
					<option value="zh_CN">中文</option>
					<option value="en_US">English</option>
				</select>
			</td>
		</tr>
		<tr height="30">
			<td colspan="2" valign="top">
				<table id="tCheckbox" style="display: none;" cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
					<tr>
						<td>
							&nbsp;&nbsp;新密码：
							<input id="newPassword" name="newPassword" class="input_login" type="password" value="" onkeydown="keyDown()"/>
						</td>
						<td>
							&nbsp;&nbsp;确认：
							<input id="newPassword2" name="newPassword2" class="input_login" type="password" value="" onkeydown="keyDown()"/>
						</td>
					</tr>
				</table>
			</td>
			<td colspan="2" align="right">
				<input class="btn_login" type="button" value="登 陆" onclick="login()"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			</td>
		</tr>
		<tr><td></td></tr>
	</table>
</form>
</body>
</html>